package com.yxdj.user.api.factory;

import com.yxdj.common.core.domain.R;
import com.yxdj.user.api.RemoteManageUserService;
import com.yxdj.user.api.domain.User;
import org.springframework.cloud.openfeign.FallbackFactory;

public class RemoteManageUserFallbackFactory implements FallbackFactory<RemoteManageUserService> {

    @Override
    public RemoteManageUserService create(Throwable throwable) {
        return new RemoteManageUserService() {
            @Override
            public R<User> login(String phone, String source) {
                return R.fail("远程调用用户微服务根据用户手机号获取用户信息失败："+ throwable.getMessage());
            }

            @Override
            public R<User> register(User user, String source) {
                return R.fail("远程调用用户微服务注册用户信息失败："+ throwable.getMessage());
            }

            @Override
            public R<User> getUserById(Long id, String source) {
                return R.fail("远程调用用户微服务根据用户id获取用户信息失败："+ throwable.getMessage());
            }
        };
    }
}
